Transformer over-current protection with RMS sensing and voltage fold-back

ABSTRACT

A method and apparatus for over-current protection of a transformer supplying a load. The method includes periodically sampling a current supplied to the load, calculating an RMS average current using the samples collected, comparing the RMS average current to a target current, and limiting an amount of power intended for the load during a subsequent cycle to the lower of a desired power value and an RMS average power value, the RMS average power value determined by the comparison of the RMS average current to the target current. The described apparatus includes a controller capable of performing a process including each of these functions. A method for selectively enabling flow of current to a load includes storing the time between the leading edge of the supply signal and the trailing edge of the supply signal and sending a first signal enabling flow of the current according to a desired conduction angle when a subsequent leading edge of the supply signal does not occur within a second time, which is at least as long as the first time. A train controller for a model toy train can incorporate the invention.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates to over-current protection of a transformersupplying one or more loads and, in particular, to over-currentprotection of a transformer supplying power to model electric trains.

2. Description of the Related Art

Conventionally, transformers are used to adapt the available electricalsupply from a generator, power supply or the common alternating currentwall outlet to the voltage, current and power levels required by anelectrical apparatus. A fuse is generally located in line with theprimary of the transformer. When the fuse reaches a certain currentlevel, it opens, protecting the transformer from overloads that maydamage it permanently, such as overheating of the insulation. In manyapplications opening, or blowing, the fuse is undesirable. In theseapplications, the simple protection afforded by such a fuse has beensupplemented by electronic protection.

One such application is in the operation of model toy trains. In thisconsumer electronics application, a blown fuse disables the use of thetrain until the fuse is replaced. Such fuses are generally not easilyaccessible or replaceable by the consumer. Electronic controls designedto minimize the current through the transformer to levels below theoperation of the fuse protect the transformer from overloads withoutoperation of the fuse. These controls can additionally protect otherinternal devices from excessive heat and power and provide a moreenjoyable experience for the consumer.

SUMMARY OF THE INVENTION

Accordingly, an accurate apparatus and method of determining the loadthrough a transformer is needed that provides appropriate over-currentprotection without appreciable reduction in the performance in the loadsconnected to the transformer. An inventive apparatus and method for moreaccurately performing phase control of the loads is also desirable,whether in combination with over-current protection or not.

Thus, the present invention includes a method for over-currentprotection of a transformer supplying an alternating current supplysignal to a load. The method includes periodically sampling a currentsupplied to the load by the supply signal during a cycle of the supplysignal, calculating a root-mean-squared (RMS) average current using thesamples collected during the cycle, comparing the RMS average current toa target current for the cycle, and limiting an amount of power intendedfor the load during a subsequent cycle of the supply signal to the lowerof a desired power value and an RMS average power value, the RMS averagepower value determined by the comparison of the RMS average current tothe target current.

The invention also includes a method for selectively enabling flow ofcurrent to a load from an alternating current supply signal connected tothe load. This method includes storing a first time passing between afirst zero-crossing of the supply signal, the first zero-crossingindicating a leading edge of the supply signal, and a secondzero-crossing of the supply signal, the second zero-crossing indicatinga trailing edge of the supply signal, and sending a first signalenabling flow of the current according to a desired conduction anglewhen a subsequent zero-crossing indicating the leading edge of thesupply signal does not occur within a second time, the second time beingat least as long as the first time.

In a train controller for a model toy train wherein the train controllerincludes means for selectively enabling flow of an alternating currentfrom a supply signal to a train track, an improvement of the presentinvention includes means for storing a first time passing between afirst zero-crossing of the supply signal and a second zero-crossing ofthe supply signal, the first zero-crossing indicating a leading edge ofthe supply signal, and the second zero-crossing indicating a trailingedge of the supply signal; and a first signal enabling flow of thealternating current through the device according to a desired conductionangle when a subsequent zero-crossing indicating the leading edge of thesupply signal does not occur within a second time, the second time beingat least as long as the first time.

The invention also includes an apparatus including a controller capableof performing a process for over-current protection of a transformersupplying an alternating current supply signal to a load. The processincludes periodically sampling a current supplied to the load by thesupply signal during a cycle of the supply signal, calculating an RMSaverage current using the samples collected during the cycle, comparingthe RMS average current to a target current for the cycle and limitingan amount of power intended for the load during a subsequent cycle ofthe supply signal to the lower of a desired power value and an RMSaverage power value, the RMS average power value determined by thecomparison of the RMS average current to the target current forover-current protection of a transformer supplying an alternatingcurrent supply signal to a load.

Other applications and details of the present invention will becomeapparent to those skilled in the art when the following description ofthe best mode contemplated for practicing the invention is read inconjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWING

The following features, advantages and other uses of the presentinvention will become more apparent by referring to the followingdetailed description and drawing in which:

FIG. 1A is a plan view of a standard model train configuration with analternating current track signal supplied by a standard 80 watttransformer and including a train controller incorporating the controlcircuit of the present invention;

FIG. 1B is a side view of the train controller of FIG. 1A;

FIG. 2 is a simplified schematic diagram of the control circuit of FIG.1A;

FIG. 3 is a flow diagram of the over-current protection routineaccording to the present invention; and

FIG. 4 is a flow diagram of the window detection routine according tothe present invention.

DETAILED DESCRIPTION

The present invention is over-current protection for a transformer,where one embodiment is shown in reference to FIGS. 1-4. In model trainsystems, a train controller, such as the simple train controller 10shown in FIG. 1A, supplies voltages to the track 12 upon which one ormore model trains (not shown) ride. Contacts on the bottom of eachtrain, or metallic wheels of the train, pick up the power from thesupply voltage signal 26 applied to the track 12 and supply it to aninternal electrical motor of the train. Auxiliary loads can be suppliedfrom another rail of the track 12. A transformer 14, not necessarilyseparate from the train controller 10, but shown so in FIG. 1, providesthe supply signal 26 to the train controller 10, which controls both theamplitude and polarity of the voltage, controlling, for example, thespeed and direction of the trains. A lever 16 rotatably mounted on ahousing 18 of the train controller 10 allows the user to control adesired average power value supplied by the train controller 10 to thetrack 12 by movement of the lever 16 in the directions I and J shown inFIG. 1B. In an HO system, the supply signal used is a direct current(DC) signal. In the electrical train configuration described herein andshown in FIG. 1A, the transformer 14 provides an alternating current(AC) electric power supply signal to the track 12. Thus, when discussingaverage current and average power herein, a root-mean-squared (RMS)average is intended. An AC track signal supplied by the transformer 12can be offset by a DC signal used to enable various train accessories,such as a horn, bell or whistle, through relays mounted on the train. Inthe simple train controller 10 shown in FIG. 1, pushbuttons 20 aremounted in the surface of the housing 18 to enable the user to indicatea desire to change the direction of trains, to sound a whistle and tosound a bell. A lamp 22 mounted in the housing 18 indicates operatingconditions of the train controller 10. For example, the lamp 22 may showa light output that varies with the power level supplied to the loadthrough the track 12. The housing 18 also encloses an electronic controlcircuit 50 of the train controller 10 that protects and controls thetransformer 14 during operation.

The control circuit 50 for the transformer 14 taps the secondary of thetransformer 14, as shown in FIG. 2. The transformer 14 can be an 80 watttransformer receiving a standard 120 volt AC supply at its primarythrough a connector 24 to, for example, a wall socket (not shown). Aconventional fast blow fuse 54 is connected in series with thetransformer 14 primary. The secondary of the transformer 14 supplies avoltage of generally twelve to 25 volts AC to the train track 12 and thetrain controller 10. The AC secondary supply signal 26 supplying theload, Loads 1 and 2, at the train track 12 is tapped at node 56 to azero crossing detector 58. The zero crossing detector 58 includes arelatively high impedance resistor 58 a, such as 100 kilo-ohms,connected between the node 56 and a controller 60, which is shown as amicrocontroller unit (MCU). Connected between the resistor 58 a and thecontroller 60 are a pair of reverse-connected Schottky diodes 58 b. Theanode of one of Schottky diodes 58 b is connected to ground, while thecathode of the other Schottky diode 58 b is reverse biased at −Vdd voltsDC, −5 volts DC by example. The common node 58 c of thereverse-connected Schottky diodes 58 b supplies a detection signal tothe controller 60 after being filtered through a grounded capacitor 58d. Of course, one of skill in the art knows that there are a multitudeof configurations that can perform zero crossing detection in place ofthe disclosed circuit design.

The controller 60 can be, as shown, a standard MCU 60, but amicroprocessor unit (MPU) with peripheral memory chips, etc., can beused in place of a microcontroller. Further, although the use of an MCUor MPU is preferred, the functions herein described with respect to thecontroller 60 can be performed in whole or in part by equivalent analogand/or digital circuitry. Although many equivalents can be used as thecontroller 60, the description herein refers to the controller 60 as theMCU 60 to more easily distinguish the controller 60 from the traincontroller 10. The MCU 60 controls, by example, the response to horn andbell pushbuttons 20, which are shown conventionally connected to the MCU60 in FIG. 2. The MCU 60 also controls an LED 68 that lights the lamp 22embedded in the housing 18 of the train controller 10. The MCU 60receives an input signal based upon the setting of a potentiometer 62,which is responsive to the movement of the lever 16. In response tochanges in the impendence of the potentiometer 62, the MCU 60 calculatesa phase conduction angle for each of the triacs 64 and 66 connected toLoads 1 and 2, respectively. The phase conduction angle is the totalangle over which the flow of current to the load occurs through thetriacs 64, 66, delivering an average power from the transformer 14.Although the phase conduction angle of each of the triacs 64, 66 can beset in a variety of ways, one way to do so starts when all threepushbuttons 20 are held down, placing the transformer in programmingmode. In this mode, one of the triacs, such as triac 66 for Load 2, iscontrolled by the lever 16. As the lever 16 moves upwards in thedirection I, the phase signal Phase 2 to Load 2 increases the conductionangle of the triac 66, thus increasing the average power supplied to theLoad 2. Similarly, as the lever 16 moves downwards in the direction J,the phase signal Phase 2 decreases the conduction angle of the triac 66,decreasing the average power supplied to the Load 2. Once the lever 16is at the desired setting for Load 2, releasing the pushbuttons 20stores the setting for Load 2. Returning the lever 16 to zero outputcauses the MCU 60 to control the average power supplied to Load 1through the triac 64 using the lever 16 by movement in the directions Iand J as previously described, while the MCU 60 controls the triac 66according to the stored setting. The conduction signals that control theconduction angles are shown in FIG. 2 as C1 and C2, which arerespectively connected to the gates of the triacs 64 and 66. The phasesignals Phases 1 and 2 are filtered to become conduction signals C1 andC2 by known circuitry, so the circuitry will not be described herein.Although only two loads controlled by respective triacs 64 and 66 areshown, the invention can be used with more or less than two loads. Theconduction angles of the triacs 64, 66 are often different, and they canbe controlled by two levers as opposed to being controlled by onepotentiometer 62.

The triacs 64 and 66 are respectively connected on one end to Loads 1and 2 through connections 28 and 30. The other ends of each triac 64, 66are commonly connected to the voltage-foldback circuit at node 72. Asensing wire 70 is connected to ground on one end, and on the other end,the sensing wire 70 is connected to the node 72 so as to receive acomplex voltage wave proportional to the current supplied to the Loads1, 2. Also at the common node 72, an input impedance 74 performing afiltering function for the non-inverting input of an operationalamplifier (op amp) 76 is connected. The input impedance 74 comprises aresistor 74 a connected at one end to the common node 72 and at theother end to the non-inverting input of the op amp 76. A cathode of adiode 74 b is also connected to the non-inverting input of the op amp76, while the anode of the diode 74 b is grounded. A filtering capacitor74 c is connected in parallel with the diode 74 b. As is standard, theop amp 76 is raised to the operating DC voltage +Vdd and is grounded. Agrounded capacitor 78 is connected to the positive power supply of theop amp 76 to provide filtering for the supply voltage +Vdd. The op amp76 has negative feedback at a gain created by resistors 80 a and 80 b.Specifically, resistors 80 a and 80 b are connected in series to groundat the output of the op amp 76, and the feedback from the invertinginput of the op amp 76 taps the junction of resistors 80 a and 80 b. Theoutput of the op amp 76 proceeds through a damping resistor 82, whichprovides input protection for the MCU 60.

In the most basic operation of the circuit, the current flowing to theLoads 1 and 2 during conduction through the triacs 64, 66 is sensed as acomplex voltage waveform across the sensing wire 70. The voltagewaveform representing the current flowing to Loads 1, 2 is fed throughthe linear operational amplifier 76 when an input channel of the MCU 60performs its sampling, as discussed below. The input channel of the MCU60 is an analog-to-digital (A/D) channel, which converts the amplifiedvoltage waveform to a digital value. Alternatively, A/D circuitry couldbe added to the board of the control circuit 50 and the input providedto a digital channel input of the MCU 60. The MCU 60 samples a series ofdigital values to calculate an actual average current. Based upon acomparison of a target current, discussed herein, and the actual averagecurrent, the MCU 60 controls the phase signals Phases 1 and 2,controlling the average power, and thus the average current, drawn bythe transformer 14 to supply the Loads 1 and 2.

More specifically, and as shown in FIG. 3, the over-current protectionroutine of the MCU 60 is continuously performed starting at 100, oncecurrent begins to flow. The routine starts by initializing valuesstarting at 102. In this initialization, the sample counter of the MCU60 is set equal to the starting count, usually 0. Also, the targetcurrent to be supplied to the load is set. The target current is acalculated average current based upon the lower of the desired averagepower setting, or value, of the potentiometer 62 or the average powervalue determined by the over-current protection routine on a previousiteration as described herein. Of course, when the train controller 10is first turned on, this target current is based upon the desired powervalue as indicated by the setting of the potentiometer 62.

At 104, the zero crossing of the input signal is detected by the MCU 60based on the input from the zero crossing detector 58. Advantageously,sampling occurs when the zero crossing detector 58 indicates that thesupply signal 26 from the transformer 14 has passed from negative topositive polarity. At 106, this is reflected by the query as to whetherthe supply signal 26 is in the positive half of the cycle or not. If thesignal 26 is not in the positive half of the cycle, i.e., it is in thenegative half of the cycle, the MCU 60 awaits the next zero crossingsignal from the zero crossing detector 58. When the supply signal 26 isin the positive half of the cycle, as indicated at 106, sampling startsat 108. As one of skill in the art recognizes, however, the conductionangles of the triacs 64, 66 are rarely the complete 180 degrees per halfcycle. Thus, while testing can start immediately after zero crossing asdescribed, testing can start later depending upon the actual conductionangles. Typically, to create a DC offset for horn and bell activation,conduction starts at about five degrees into each half cycle, but canstart later if the average power setting of the potentiometer 62 is low.

A predetermined number of samples is taken at 108. Thus, after eachsample is taken at 108, the routine advances to 110, where a querydetermines whether the counter, initialized at 102, has reached thedesired number, or count, of samples. If the desired count has not beenreached, the MCU 60 increments the counter by one and takes anothersample at 108. This continues until the counter is equal to the desiredcount, i.e., the targeted number of samples has been reached, then theroutine advances to 114, where the actual average current suppliedthrough the triacs 64, 66 is calculated. It is useful to note that eventhough there is a target current, as specified at 102, the actualaverage current can exceed that target current based upon a number offactors such as faults, heavy start-up motor loads and supply voltagedrops, for example, resulting in an resulting over-current condition.

The number of samples and the interval between samples can vary basedupon the operation of the train controller 10. For example, sincecurrent does not typically flow until several degrees past zerocrossing, sampling does not have to begin immediately after the zerocrossing detector 58 indicates to the MCU 60 that a zero crossing hasoccurred as previously mentioned. Ideally, the signals C1 and C2 nolonger enable conduction at the end of each half cycle so testing couldtheoretically end at 180 degrees. Experiments have shown, however, thatsignificant levels of current flow can result from the inductance of thetransformer 14, continuing even after the conduction signals C1 and C2would normally no longer enable the triacs 64, 66. Under certaincircumstances, a total of five amps supplied to the Loads 1, 2 at up to180 degrees was supplemented by up to three or four amps whenmeasurement occurred up to about five to ten degrees past the negativezero crossing, that is, the zero crossing where the polarity of theinput signal changes from positive polarity to negative polarity,depending upon the average power setting and the resulting conductionangle. One set of circumstances where this can occur is where outputterminals are mounted to the train controller 10 for the connections 28,30 to each of the Loads 1, 2, respectively. A short caused by ascrewdriver across the output terminals, for example, will cause thiscurrent flow past zero crossing. This additional current flow during theperiod from about five to ten degrees after 180 degrees can besufficient to blow the fast blow fuse 54 on the transformer 14 primary.Therefore, it is beneficial for the MCU 60 to sample the current untilup to about five to ten degrees past 180 degrees, depending upon theconduction angles.

As seen from this discussion, a number of samples over the entiretesting period is taken. A minimum sample number is desirable to arriveat an actual average current with any degree of accuracy. Testing hasshown that a minimum number of samples of the input waveform isapproximately eight samples. However, thirty-two samples gives a largeenough sample base to arrive at an answer to several decimal places ofaccuracy. Additional samples can be taken, but accuracy is not greatlyimproved using the additional samples. The interval between samplestaken over the testing period can be determined by a variety of methods.One advantageous method occurs where the MCU 60 uses the expectedfrequency of the input waveform, 60 Hz in the United States by example,and calculates the sampling interval based upon the number of samplesthat need to be gathered during the testing period, which isapproximately half of a cycle. Other methods include setting a samplinginterval based upon the minimum expected period, then testing for thezero crossing from positive to negative polarity. Instead of queryingfor a total desired number of samples at 110, the sampling continuesuntil a certain period of time, or a certain number of samples past thezero crossing. This results in a more complicated routine as the numberof samples potentially varies during each testing period. Other ways ofperforming the sampling over the testing period are possible.

The actual average current is calculated from the samples at 114. Asmentioned previously, the average current is the RMS average current.The samples can be individually stored and the average calculated fromthe stored sample values or, alternatively, the sampled values can beaccumulated while the sampling occurs, and then the average can becalculated. In its simplest embodiment, the average current calculatedat 114 is compared to the target current at 116. If this actual averagecurrent calculated at 114 is less than or equal to the target current inresponse to the query at 116, then the LED 68 stops blinking at 117 ifit was previously blinking as a result of the operation of theover-current protection routine as discussed herein. The routine thenends at 124. The routine begins again at 100 and repeats as long as thetrain controller 10 is supplied power. This means that, in practice, theover-current protection routine runs during each cycle, taking samplesmostly during the positive half of the input waveform and performing itscalculations and adjustments for the next cycle during the negative halfof the input waveform.

Returning now to 1116, if the actual average current is greater than thetarget current, then this indicates that the phase control signals Phase1, 2 need to be adjusted to reduce the average power supplied from thetransformer 14 in order to reduce the average current. During operation,however, certain loads receiving input power from the transformer 14 candraw odd input waveforms based upon the characteristics of the load. Forexample, typical DC motors located in an engine locomotive do not demandlarge inrush currents to start. However, more modern AC motors maydemand up to seven amps to start, then settle at a load of about twoamps. Therefore, in determining the amount of the reduction, it isadvantageous to incorporate software filtering into the over-currentprotection routine for this circumstance and others at 118. The softwarefiltering is intended to distinguish between, for example, a directshort, that results in a very quick decrease in output voltage, withthis startup current required by certain engines, which also results ina sudden drop of voltage. The software filtering of the MCU 60 canperform its function in a variety of ways using known techniques. Thesoftware filtering of the MCU 60 can, for example, compare the samplesto a recognized pattern, or profile, for particular motors determined bytesting. For example, if each of the samples is stored, a best fit curvecan be compared against curves determined for a variety of loads usingsampled data for each load. Alternatively, for example, peak and minimumvalues, as well as time between these values, etc., sampled during thetest period can be used to determine the characteristics of the currentcurve from which to determine the response to the over-current conditionby the MCU 60 at 120.

At 120, the phase signals Phases 1, 2 sent from the MCU 60 to the triacs64 and 66 are adjusted to reduce the current flow supplied to Loads 1and 2, respectively, by decreasing the conduction angles below theangles set by the prior average power setting at 102. Specifically, theMCU 60 controls the phase signals Phase 1 and Phase 2 that are filteredto become conduction signals C1 and C2 to enable the conduction throughthe triacs 64 and 66, respectively, later in each subsequent half cycle.These reductions are calculated by the MCU 60 and are based upon adesire to minimize the effect on the user of the reduction, while at thesame time protecting the transformer 14 and other components includingthe blow fuse 54. To this end, when the actual average current exceedsthat determined based upon the average power setting, the softwarefiltering results in a minor decrease in the average power setting, justenough to keep the current under the target current determined by theprior average power setting at 102, whereas a direct short will resultin a very quick decrease in the average power setting for the nextcycle.

When the current is limited as a result of the over-current routine at120, the LED 68 blinks to indicate activation of the over-currentprotection routine at 122. The routine then ends at 124. If the userrequests an increase in average power by moving the lever 16 upwards inthe direction I while the over-current routine is activated, the averagepower setting of the potentiometer 62 is raised. This new average powersetting based on the setting of the potentiometer 62 is compared againstthe average power setting determined at 120 to determine the targetcurrent at 102 in the next iteration. Thus, if the lever 16 is used torequest additional power while the over-current protection is activatedto limit the average power setting, and hence the current, no change inthe target current is made. If, however, the lever 16 is used to requestadditional power, and the over-current protection routine is notlimiting the average power setting, the target current is based upon thenew average power setting of the potentiometer 62. When the over-currentprotection routine is limiting the average power setting below theaverage power setting of the potentiometer 62, movement of the lever 16downwards in the direction J to such a point where the average powersetting of the potentiometer 62 is below the average power settingdetermined at 120 causes the LED 68 to stop blinking as previouslydiscussed with respect to 117.

As mentioned, the inductance of the transformer 14 can result in theflow of current to the load occurring after 180 degrees of each halfcycle of the supply signal 26. This can result in a problem in operatingthe transformer 14 during both normal and over-current conditions.Particularly where the conduction angle starts at an angle of less thanfive degrees, the effect of inductance can result in a shift in the zerocrossing reference from the input signal to change, forcing the systemtiming to change and the system to become unstable. Another situationwhere this can occur is a short across the output terminals of the traincontroller 10 as previously discussed. The resulting timing change canalso result in over-current conditions sufficient to blow the fast blowfuse 54. Therefore, it is beneficial to incorporate an inventive windowdetection routine into the software controlling the MCU 60, whether ornot the over-current protection routine of the present invention isincluded. The window detection routine is designed to control theconduction angles to maintain the system timing. The last good trailingedge of the supply signal 26, i.e., where the voltage of the supplysignal 26 passes from positive to negative polarity, is used to predictwhen the leading edge is supposed to occur, i.e., the change in thevoltage of the supply signal 26 from negative to positive polarity.Then, the conduction of the triacs 64, 66 is enabled according to thatdetermined by the average power setting, even if the zero crossingdetector 58 does not detect a zero crossing.

One way of implementing the window detection routine is shown in FIG. 4.The routine starts at 150, when power is supplied to the traincontroller 10. The window detection routine can run concurrently withthe over-current protection routine previously described. A timer of theMCU 60 starts at 152 and continues to increment at 154 until a zerocrossing is sensed by the zero crossing detector 58. The routine thenadvances to 156, where the MCU 60 stops the timer and stores theresulting time. The MCU 60 then determines whether that zero crossingindicated a trailing edge or not at 156. If the supply signal 26 was notgoing from positive polarity to negative polarity at the detected zerocrossing, then the routine returns to 152, where the timer startskeeping track of the amount of time that passes to the next zerocrossing.

Returning now to 158, if the zero crossing detector 58 detects a zerocrossing of the trailing edge, the routine proceeds to 160, where theMCU 60 again starts a timer. The MCU 60 continuously checks for a zerocrossing at 162. Each time a zero crossing is not sensed at 162, thevalue of the timer is compared to an expected time based upon the storedtime. For example, the expected time could be the stored time plus asmall amount of time reflecting expect minor variations in the supplysignal 26. If the timer value is less than the expected time at 164, thezero crossing is not expected. The MCU 60 continues to monitor for thesensed zero crossing at 162. Returning to 162, if the zero crossingdetector 58 indicates a zero crossing, the timer starts again at 160.The conduction signals trigger conduction of the triacs 64, 66 accordingto the normal operation of the MCU 60.

Returning now to 164, if the timer value exceeds the expected time, thetrain controller 10 can become unstable unless the timing is maintained.Therefore, the routine advances to 166, where the MCU 60 sends phasesignals Phases 1, 2 to cause conduction signals C1 and C2 to enableconduction across the triacs 64, 66 at a conduction angle determinedaccording to the average power setting of the train controller 10,whether the average power setting is based upon the potentiometer 62setting or the average power setting determined by the over-currentprotection routine. The routine again returns to 160 to start the timerof the MCU 60 and again await the zero crossing point of the supplysignal 26.

The inventive train controller 10 described herein can provide valuableover-current protection for a transformer 10 supplying power to aplurality of loads. The train controller 10 can prevent systeminstability resulting from errors in system timing due to theincorporation of a window detection routine, which can be separate fromor incorporated with the over-current protection.

While the invention has been described in connection with what ispresently considered to be the most practical and preferred embodiment,it is to be understood that the invention is not to be limited to thedisclosed embodiments but, on the contrary, is intended to cover variousmodifications and equivalent arrangements included within the spirit andscope of the appended claims, which scope is to be accorded the broadestinterpretation so as to encompass all such modifications and equivalentstructures as is permitted under the law.

What is claimed is:
 1. A method for over-current protection of atransformer supplying an alternating current supply signal to a load,comprising: periodically sampling a current supplied to the load by thesupply signal during a cycle of the supply signal; calculating aroot-mean squared (RMS) average current using the samples collectedduring the cycle; comparing the RMS average current to a target currentfor the cycle; and limiting an amount of power intended for the loadduring a subsequent cycle of the supply signal to the lower of a desiredpower value and an RMS average power value, the RMS average power valuedetermined by the comparison of the RMS average current to the targetcurrent.
 2. The method according to claim 1, further comprising:calculating a target current for the subsequent cycle of the supplysignal based upon the amount of power intended for the load during thesubsequent cycle.
 3. The method according to claim 1, furthercomprising: choosing a desired power value for the load prior toperiodically sampling the current; and using the desired power value todetermine the target current for the cycle.
 4. The method according toclaim 1, further comprising: visibly indicating when the amount of powerintended for the load is lower than the desired power value.
 5. Themethod according to claim 1 wherein periodically sampling the currentfurther comprises collecting at least eight samples during the cycle. 6.The method according to claim 5 wherein collecting at least eightsamples during the cycle further comprises collecting 32 samples duringthe cycle.
 7. The method according to claim 1, further comprising:creating a current profile based upon the samples collected during thecycle; comparing the current profile to at least one known currentprofile; and determining the RMS average power value based upon theresults of the comparison of the current profile to the at least oneknown current profile.
 8. The method according to claim 7, furthercomprising: creating the at least one known current profile using arespective known load.
 9. The method according to claim 1, furthercomprising: determining at least one characteristic of the samplescollected during the cycle, the at least one characteristic including amaximum current, a minimum current and a rate of change of the current;and using the at least one characteristic to determine the RMS averagepower value.
 10. The method according to claim 1, further comprising:specifying an RMS average power value lower than the desired power valuewhen the RMS average current is greater than the target current.
 11. Themethod according to claim 1, further comprising: enabling supply of thecurrent to the load during a portion of the cycle using a triacconnected in series with the load.
 12. The method according to claim 11,further comprising: supplying one of the desired power value and the RMSaverage power value for the cycle by setting a conduction angle for thetriac.
 13. The method according to claim 11, further comprising: storinga first time passing between a first zero-crossing of the supply signaland a second zero-crossing of the supply signal, the first zero-crossingindicating a leading edge of the supply signal, and the secondzero-crossing indicating a trailing edge of the supply signal; andsending a first signal enabling conduction of the triac according to aconduction angle of the triac when a subsequent zero-crossing indicatingthe leading edge of the supply signal does not occur within a secondtime, the second time being at least as long as the first time.
 14. Themethod according to claim 1 wherein the load is one of a plurality ofloads, and further comprising: periodically sampling a total currentsupplied to the plurality of loads during a cycle of the supply signal;and calculating the RMS average current using samples of the totalcurrent collected during the cycle.
 15. The method according to claim 1wherein periodically sampling the current supplied to the load furthercomprises connecting a sensing wire so as to receive a plurality ofcomplex voltage signals proportional to the current supplied to theload; and wherein calculating the RMS average current further comprisescalculating an RMS average current using the plurality of complexvoltage signals.
 16. The method according to claim 15 whereincalculating the RMS average power further comprises calculating an RMSaverage of the plurality of complex voltage signals.
 17. The methodaccording to claim 1, further comprising: detecting a zero-crossing ofthe supply signal, the zero-crossing indicating a change in polarity ofthe supply signal from one of negative to positive and positive tonegative; and periodically sampling the current during a portion of thecycle starting while the supply signal has a positive polarity andending while the supply signal has a negative polarity.
 18. The methodaccording to claim 17 wherein periodically sampling the current startsat about five to ten degrees after a first zero-crossing indicates achange in polarity of the supply signal from negative to positive andends at about five to ten degrees after a second zero-crossing indicatesa change in polarity of the supply signal from positive to negative. 19.A train controller for a model toy train including the method accordingto claim
 1. 20. An apparatus including a controller capable ofperforming a process for over-current protection of a transformersupplying an alternating current supply signal to a load, the processcomprising: periodically sampling a current supplied to the load by thesupply signal during a cycle of the supply signal; calculating aroot-mean squared (RMS) average current using the samples collectedduring the cycle; comparing the RMS average current to a target currentfor the cycle; and limiting an amount of power intended for the loadduring a subsequent cycle of the supply signal to the lower of a desiredpower value and an RMS average power value, the RMS average power valuedetermined by the comparison of the RMS average current to the targetcurrent.
 21. The apparatus according to claim 20, further comprising: alamp for visibly indicating when the amount of power intended for theload is lower than the desired power value.
 22. The apparatus accordingto claim 20 wherein a target current for the subsequent cycle of thesupply signal is based upon the amount of power intended for the loadduring the subsequent cycle.
 23. The apparatus according to claim 20,further comprising: a handle for choosing a desired power value for theload prior to periodically sampling the current; and wherein the targetcurrent for the cycle is determined using the desired power value. 24.The apparatus according to claim 23, further comprising: a potentiometeroperated by the handle, an impedance of the potentiometer correspondingto a unique desired power value.
 25. The apparatus according to claim20, further comprising: a triac connected in series with the load, thetriac enabled to supply the current to the load during a portion of thecycle, the portion determined by a conduction angle determined by thecontroller.
 26. The apparatus according to claim 25, further comprising:a zero-crossing detector detecting a first zero-crossing of the supplysignal and a second zero-crossing of the supply signal, the firstzero-crossing indicating a leading edge of the supply signal and thesecond zero-crossing indicating a trailing edge of the supply signal;and wherein the process further includes: storing a first time passingbetween the first zero-crossing and the second zero-crossing; andsending a first signal enabling conduction of the triac according to aconduction angle when a subsequent zero-crossing indicating the leadingedge of the supply signal does not occur within a second time, thesecond time being at least as long as the first time.
 27. The apparatusaccording to claim 20 wherein calculating an RMS average current uses anumber of samples collected during the cycle of at least eight samples.28. The apparatus according to claim 20, further comprising: a currentsense circuit receiving a plurality of complex voltages proportional tothe current and supplying the plurality of complex voltages to an inputof the controller.
 29. The apparatus according to claim 28, wherein thecurrent sense circuit comprises: a grounded sensing wire connected so asto detect the plurality of complex voltages; and an amplifier receivingthe plurality of complex voltages and supplying the plurality of complexvoltages to the input.
 30. The apparatus according to claim 20, furthercomprising: software filtering operable by the controller, the softwarefiltering determining at least one characteristic of the samplescollected during the cycle and using the at least one characteristic todetermine the RMS average power value.
 31. The apparatus according toclaim 30 wherein the at least one characteristic comprises at least oneof a maximum current, a minimum current and a rate of change of thecurrent.
 32. The apparatus according to claim 20, further comprisingsoftware filtering operable by the controller, the software filteringincluding: creating a current profile based upon the samples collectedduring the cycle; comparing the current profile to at least one knowncurrent profile; and determining the RMS average power value based uponthe results of the comparison of the current profile to the at least oneknown current profile.
 33. The apparatus according to claim 20 whereinthe load is one of a plurality of loads, and further comprising: arespective triac connected in series with each of the plurality ofloads, each triac enabled by a respective conduction angel to supply aportion of the current to each of the plurality of loads during a cycle.34. The apparatus according to claim 20 wherein the RMS average powervalue is lower than the desired power value when the RMS average currentis greater than the target current.